extends Control

@export var game_stats: GameStats

@onready var experoence_bar: TextureProgressBar = $ExperoenceBar

func _ready() -> void:
	
	game_stats.ship_experience_change.connect(update_ship_experience)
	update_ship_experience()
	
	tree_exited.connect(func ():
		game_stats.ship_experience_change.disconnect(update_ship_experience)
		)

func update_ship_experience() -> void:
	var percentage := game_stats.ship_experience / float(game_stats.level_up_need_exp)
	
	#experoence_bar.value = percentage
	create_tween().tween_property(experoence_bar, "value", percentage, 0.2)
